package com.verbetia.musictrends.web.auth;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.verbetia.musictrends.persistence.hsqldb.UserEntity;

public class LogoutUser extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{			
		UserEntity u = (UserEntity)request.getSession().getAttribute("User");
		
		/*
		if (u==null)
		{
			response.sendRedirect("index.jsp");
			return;
			
		}
			*/
		
		request.getSession().removeAttribute("User");
		request.getSession().removeAttribute("username");
		
		response.sendRedirect("index.jsp");
		
	}

}
